
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
json-expressible
Advanced tools
Micro library that determines whether a value can be expressed as JSON.
An ES5 Javascript micro library that determines whether a value can be expressed as JSON.
Checks whether the value is a valid JSON type (string, number, boolean, null, object, or array).
Recursively checks whether object children and/or array elements are valid JSON types.
Checks whether there are any circular references.
The motivation for this library is twofold:
The JSON.stringify()
function does not throw an error when it encounters
non-JSON values like undefined
and NaN
. Instead, it omits the values or
converts them to null
in the returned serialization. As a result, parsing
the serialization does not return the original value.
It can be useful to know whether a value is expressible in JSON without actually serializing it.
To install:
npm install json-expressible
To use:
var jsonExpressible = require("json-expressible");
// The following return true
console.log(jsonExpressible("abc"));
console.log(jsonExpressible(123));
console.log(jsonExpressible(true));
console.log(jsonExpressible(null));
console.log(jsonExpressible({ abc: "def" }));
console.log(jsonExpressible([1, 2, 3]));
// The following return false
console.log(jsonExpressible(undefined));
console.log(jsonExpressible(NaN));
console.log(jsonExpressible(function () {}));
console.log(jsonExpressible(new Date()));
console.log(jsonExpressible(Infinity));
console.log(jsonExpressible(/reg.ex/));
console.log(jsonExpressible([ undefined ]));
console.log(jsonExpressible({ abc: undefined }));
var circularObject = {};
circularObject.ref = circularObject;
console.log(jsonExpressible(circularObject));
var circularArray = [];
circularArray.push(circularArray);
console.log(jsonExpressible(circularArray));
FAQs
Micro library that determines whether a value can be expressed as JSON.
We found that json-expressible demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.